<%@ page import="java.io.*, java.text.*, java.util.Date, java.sql.*, javax.servlet.*, javax.servlet.http.*, java.util.*" %>
<%
String usernameSC = (String) session.getAttribute("session_name");
String idSC = (String) session.getAttribute("id");
String typeSC = (String) session.getAttribute("type");
if(usernameSC != null && (typeSC.equals("committee") || typeSC.equals("root"))) {
%>
<%
String driver ="com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/projects";
String username = "ia";
String password = "123";
String id = request.getParameter("id");
String ids = null;
String usernameD = null;
String type = null;
String status = null;
String ref_id = null;
String name = null;

try
{
	Class.forName(driver).newInstance();
	
	Connection connection = DriverManager.getConnection(url, username, password);
	
	Statement statement = connection.createStatement();
	Statement statement1 = connection.createStatement();
	//String query = "select count(*) from user_log_in";
	String query1 = "select * from user_log_in u, professor p where p.id = u.ref_id and u.id="+id;
	//ResultSet rs = statement.executeQuery(query);
	ResultSet rs1 = statement.executeQuery(query1);
	/*if(rs.next())
	{
		size = rs.getInt(1);
	}*/
	
	if(rs1.next())
	{
		id = rs1.getString("id");
		type = rs1.getString("type");
		status = rs1.getString("status");
		usernameD = rs1.getString("username");
		name = rs1.getString("first_name") + " " + rs1.getString("last_name");
	}

	connection.close();
		
}catch(ClassNotFoundException cnfe)
{
		out.println("<br>Couldn't find class file" + cnfe); 
}catch(SQLException sqle)
{
		out.println("<br>SQL Exception: " + sqle);
}catch(InstantiationException ie)
{
		out.println("<br>Instant exception : " + ie);
}catch(IllegalAccessException iae)
{
		out.println("<br>Illegal access exception : " + iae);
}
%>
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<link rel="STYLESHEET" href="styles/project.css" type="text/css">
</head>
<body>
<table>
<tr>
<td>
name:
</td>
<td>
<%=name%>
</td>
</tr>
<tr>
<td>
username:
</td>
<td>
<%=usernameD%>
</td>
</tr>
<tr>
<td>
type:
</td>
<td>
<%=type%>
</td>
</tr>
<tr>
<td>
status:
</td>
<td>
<%=status%>
</td>
</tr>
</table>
</body>
</html>
<%
} else
	response.sendRedirect("error.jsp");
%>